package com.dems.admin.controller;

import com.dems.admin.security.SecurityUtils;
import com.dems.domain.AlarmMessageReqVO;
import com.dems.domain.JsonResponse;
import com.dems.domain.alarm.AlarmMessageDto;
import com.dems.service.AlarmMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/alarmMessage")
public class AlarmMessageController {

    @Autowired
    private AlarmMessageService alarmMessageService;

    @PostMapping("/find")
    public JsonResponse findByPage(@RequestBody AlarmMessageReqVO alarmMessageReqVO){
        return JsonResponse.success(alarmMessageService.selectByPage(alarmMessageReqVO));
    }

    @PostMapping("/update")
    public JsonResponse update(@RequestBody AlarmMessageDto alarmMessageDto){
        return JsonResponse.success(alarmMessageService.confirmAlarm(alarmMessageDto, SecurityUtils.getLoanassistUser()));
    }
}
